package com.sjzsqjy.asdtiang.action;

import java.util.List;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.struts2.ServletActionContext;


import com.opensymphony.xwork2.ActionContext;
import com.opensymphony.xwork2.ActionSupport;
import com.sjzsqjy.asdtiang.db.ShareService;

public class ListAllViewAction extends ActionSupport {
	private List<?> list;

	private int pageNow = 1; 
	private int pageSize = 1; 
	private int pageTotle = 1;
	private String hql;
	private ShareService shareServer;
	private Log log = LogFactory.getLog(ListAllViewAction.class);

	public List getList() {
		return list;
	}

	public void setList(List<?> list) {
		this.list = list;
	}

	public int getPageNow() {
		return pageNow;
	}

	public void setPageNow(int pageNow) {
		this.pageNow = pageNow;
	}

	public int getPageSize() {
		return pageSize;
	}

	public void setPageSize(int pageSize) {
		this.pageSize = pageSize;
	}

	public int getPageTotle() {
		return pageTotle;
	}

	public void setPageTotle(int pageTotle) {
		this.pageTotle = pageTotle;
	}

	@Override
	public String execute() throws Exception {
      
		List l =null;
		if (l.size() == 0) {
			return "noview";
		}
		if(l.size()>pageSize){
		    list = l.subList(0, pageSize);
		}
		else{
			list=l;
		}
		ActionContext.getContext().getSession().put("list", l);
		int i = l.size();
		log.info("size:    " + i);
		pageTotle = i % pageSize == 0 ? i / pageSize : i / pageSize + 1;
		return SUCCESS;
	}



}
